Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore own messages without room_id #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jspricke
Copy link
Contributor

I got this backtrace:

Traceback (most recent call last):
File ".weechat/python/matrix/utf.py", line 89, in wrapper
return function(*args, **kwargs)
File ".weechat/python/autoload/matrix.py", line 343, in receive_cb
server.handle_response(response)
File ".weechat/python/matrix/server.py", line 1621, in handle_response
self.handle_error_response(response)
File ".weechat/python/matrix/server.py", line 1591, in handle_error_response
self.handle_own_messages_error(response)
File ".weechat/python/matrix/server.py", line 1234, in handle_own_messages_error
room_buffer = self.room_buffers[response.room_id]
KeyError: ''

Not sure if ignoring is the best solution but probably better then
throwing an exception.

I got this backtrace:

Traceback (most recent call last):
  File ".weechat/python/matrix/utf.py", line 89, in wrapper
    return function(*args, **kwargs)
  File ".weechat/python/autoload/matrix.py", line 343, in receive_cb
    server.handle_response(response)
  File ".weechat/python/matrix/server.py", line 1621, in handle_response
    self.handle_error_response(response)
  File ".weechat/python/matrix/server.py", line 1591, in handle_error_response
    self.handle_own_messages_error(response)
  File ".weechat/python/matrix/server.py", line 1234, in handle_own_messages_error
    room_buffer = self.room_buffers[response.room_id]
KeyError: ''

Not sure if ignoring is the best solution but probably better then
throwing an exception.
@poljar
Copy link
Owner

poljar commented Jul 3, 2021

Any more info about that error, did another traceback happen before whas there some user interaction before that happened?

That method is used to print out messages that you sent out, so it's strange that you sent a message in a buffer that doesn't exist.

@jspricke
Copy link
Contributor Author

jspricke commented Jul 3, 2021

I've found the error four times in my logs, every time I've send a message to someone at the same time. Nothing else in the logs around that time. Anything else I should check?

@poljar
Copy link
Owner

poljar commented Jul 3, 2021

Actually looking at this, the key that it's using is an empty string, e.g. Python prints out the key in the traceback:

>>> x["a"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'a'

The room id is passed into the method that is sending out the request and added to the response, it's not part of the server response. Something strange is going on, could you expand on what "at the same time" means?

@jspricke
Copy link
Contributor Author

jspricke commented Jul 3, 2021

Message by me Traceback
2021-04-23 23:23:15 2021-04-23 23:23:21
no new message 2021-04-23 23:23:35
2021-06-22 10:03:20 2021-06-22 10:03:23
2021-06-22 10:04:06 2021-06-22 10:04:09

Also logs from python.server.matrix_org.weechatlog:

2021-04-23 03:06:16     --      matrix: Already logged in, syncing...
2021-04-23 23:23:21     =!=     matrix: Error: RoomSendError: 520 unknown error
2021-04-23 23:23:35     =!=     matrix: Error: RoomSendError: 520 unknown error
2021-04-23 23:24:49     --      matrix: disconnected from server
2021-06-22 03:56:13     --      matrix: Already logged in, syncing...
2021-06-22 10:03:23     =!=     matrix: Error: RoomSendError: 429 unknown error
2021-06-22 10:04:09     =!=     matrix: Error: RoomSendError: 429 unknown error
2021-06-22 10:10:12     =!=     matrix: Error: SyncError: 520 unknown error
2021-06-22 10:10:12     --      matrix: disconnected from server

@poljar
Copy link
Owner

poljar commented Jul 3, 2021

Message by me Traceback
2021-04-23 23:23:15 2021-04-23 23:23:21
no new message 2021-04-23 23:23:35
2021-06-22 10:03:20 2021-06-22 10:03:23
2021-06-22 10:04:06 2021-06-22 10:04:09

Also logs from python.server.matrix_org.weechatlog:

2021-04-23 03:06:16     --      matrix: Already logged in, syncing...
2021-04-23 23:23:21     =!=     matrix: Error: RoomSendError: 520 unknown error
2021-04-23 23:23:35     =!=     matrix: Error: RoomSendError: 520 unknown error
2021-04-23 23:24:49     --      matrix: disconnected from server
2021-06-22 03:56:13     --      matrix: Already logged in, syncing...
2021-06-22 10:03:23     =!=     matrix: Error: RoomSendError: 429 unknown error
2021-06-22 10:04:09     =!=     matrix: Error: RoomSendError: 429 unknown error
2021-06-22 10:10:12     =!=     matrix: Error: SyncError: 520 unknown error
2021-06-22 10:10:12     --      matrix: disconnected from server

That almost explains it, but we make sure that the error type takes another path, only a valid RoomSendMessage response gets passed to that method: https://github.com/poljar/weechat-matrix/blob/master/matrix/server.py#L1641

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants